package com.sphd.Restaurant.adapters;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.sphd.Restaurant.fragments.OrderItemFragment;
import com.sphd.Restaurant.infos.Sorts;

import java.util.List;

/**
 * Created by Hu on 2016/10/11.
 */

public class OrderAdapter extends FragmentPagerAdapter {
    List<OrderItemFragment> fragments;
    List<Sorts> sortses;

    public OrderAdapter(FragmentManager fm, List<OrderItemFragment> fragments, List<Sorts> sortses) {
        super(fm);
        this.fragments=fragments;
        this.sortses=sortses;
    }


    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return sortses.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return sortses.get(position).getSort();
    }
}
